﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LDSP.BRL;
using LDSP.Helper;

namespace LDSP.UI.EnterpriseAdmin
{
    public partial class Left : LDSP.BRL.BaseEnterpriseAdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (LoginUser != null)
            {
                bool isEnterpriseGroupUser = this.LoginUser.Enterprise.IsEnterpriseGroup;

                this.Label1.Text = "    您好, " + LoginUser.Name + "!";
                var list = LoginUser.Enterprise.GetModuleList();

                if (isEnterpriseGroupUser)
                {
                    //集团用户
                    if (!list.Contains(ModuleName.CaseLib))
                    {
                        ph_caseLib.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.ChemicalMng))
                    {
                        ph_chemicalMng.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.Report))
                    {
                        ph_report_eg.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.UserMng))
                    {
                        ph_userMng_eg.Controls.Clear();
                    }

                    ph_favorate_codification.Controls.Clear();
                    ph_sys_codification.Controls.Clear();
                    ph_report.Controls.Clear();
                    ph_userMng.Controls.Clear();
                    ph_setting.Controls.Clear();
                    ph_help.Controls.Clear();
                }
                else
                {//子公司或普通企业用户
                    if (!list.Contains(ModuleName.CaseLib))
                    {
                        ph_caseLib.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.ChemicalMng))
                    {
                        ph_chemicalMng.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.Report))
                    {
                        ph_report.Controls.Clear();
                    }
                    if (!list.Contains(ModuleName.UserMng))
                    {
                        ph_userMng.Controls.Clear();
                    }

                    ph_taskplan_eg.Controls.Clear();
                    ph_report_eg.Controls.Clear();
                    ph_userMng_eg.Controls.Clear();
                    ph_setting_eg.Controls.Clear();
                    ph_help_eg.Controls.Clear();

                }
            }
        }

        protected void lnkBtnExit_Click(object sender, EventArgs e)
        {
            Logout();
        }
    }
}